package com.minxin.springboot;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by wangpeng on 2017/3/1.
 */
@RestController
public class SpringBootController {

    @Value(value = "${book.author}")
    private String bookAuthor;
    @Value("${book.name}")
    private String bookName;
    @Value("${book.pinyin}")
    private String bookPinYin;

    @Autowired
    private BookBean bookBean;

    Logger logger = LoggerFactory.getLogger(getClass());

    @RequestMapping(value = "/springboot")
    private String helloSpringBoot(){
        return "Hello Spring Boot !!" + bookAuthor + "---" + bookName + "---" + bookPinYin;
    }

    @RequestMapping(value = "/book")
    private String book(){
        logger.info("------日志------");
        return bookBean.getName() + "---" + bookBean.getAuthor() + "---" + bookBean.getPrice();
    }

}
